Hi All, I've been trying to customise the Word Export window that pops up after the execution of a trigger that I have created - basically I would like the Word Export dialog box that pops up due to my trigger to have the settings/toggles/drop down menus already pre-selected correctly so the user does not have to select them every time. The sequence leading to the Word Export window popping up is:
It's at this point that the Word Export dialog box pops up due to the code below, but the options that I set below are not selected in the dialog box that pops up. I've tried unsuccessfully to add the code "hide(exportBox); show(exportBox)" to the end of the "DXLCode" string to in essence 'refresh' the dialog box, but all that does is create a second un-closeable dialog box behind the original Word Export dialog box (albeit with the correct options selected!). Is there a way to make sure the pre-selected options I define in my DXL below get reflected in the dialog box that pops up? Thanks, Daniel
string DXLCode = "
Trigger trg = current; if (null trg) halt()
Module m = current; if (null m) halt ()
string exportstatus = m.\"Export Status\"
noError()
if(!null exportstatus and exportstatus == \"True\")
{
if(load view \"Export Matrix View\")
{
#include <standard/export/office/word.dxl>
set(exportLayoutChoice, layoutTypeTable)
set(exportHeadingsToggle, false)
set(exportWarnUnregOLE, false)
set(exportAttributeToggle,true)
set(useStyleToggle, false)
set(styleMappingToggle, true)
set(advancedNormalTemplateToggle, false)
set(advancedTemplateName, (NLS_(\"Choose Correct Template File.dot\")))
inactive exportAttributeToggle
active advancedTemplateName
active advancedTemplateLabel
}
}
lastError()
"
Trigger trg
bool TrigOK = true
string ErrMess = checkDXL(DXLCode)
if (!null ErrMess)
{
print ErrMess "\n***********\n" DXLCode "**********\n"
TrigOK = false
}
string NameTrig = "Export Status Trigger"
string Prompt = "Delete trigger '" NameTrig "' ??"
if (!TrigOK) Prompt = "Trigger code has errors.\n" Prompt
if (confirm(Prompt))
ErrMess = delete (NameTrig, module->attribute->"Export Status", post, save, 15)
if (TrigOK and confirm("Deploy trigger '" NameTrig "' ??"))
trg = trigger(NameTrig, module->attribute->"Export Status", post, save, 15, DXLCode)
dyfuse - Mon Dec 01 23:37:23 EST 2014 |
Re: Customisation of Word Export options Uhm ... it doesn't work that way. To remote control dialogs you need to have your code in a certain order: 1. hooks (hook show /block, call realize instead) 2. include your original dialog file 3. set your options 4. call block / show (or trigger the dialog action directly) Your code does not have any hooks, that is why your code will set any options on the dialog. Look through the forum to find examples on how to place the hooks. Hope that helps, Regards, Mathias |
Re: Customisation of Word Export options Mathias Mamsch - Tue Dec 02 05:52:59 EST 2014 Uhm ... it doesn't work that way. To remote control dialogs you need to have your code in a certain order: 1. hooks (hook show /block, call realize instead) 2. include your original dialog file 3. set your options 4. call block / show (or trigger the dialog action directly) Your code does not have any hooks, that is why your code will set any options on the dialog. Look through the forum to find examples on how to place the hooks. Hope that helps, Regards, Mathias Thanks for your quick reply Mathias! A DXL newbie here, so it's greatly appreciated! I've had a look around the forums and have added the hooks (hook show/block and call realize instead). However, in step 4 above you note to "call block / show (or trigger the dialog action directly)". I'm not sure how to do this....can you tell me how I can achieve this? And will this step reproduce a new Word Export dialog box with the correct options that I've set? My revised code now:
string DXLCode = "
Trigger trg = current; if (null trg) halt()
Module m = current; if (null m) halt ()
string exportstatus = m.\"Export Status\"
noError()
if(!null exportstatus and exportstatus == \"True\")
{
if(load view \"Export Matrix View\")
{
bool confirm (string s) { print \"Confirmed: \" s \"\n\"; return true }
void ack (string s) {print \"Acknowledge: \" s \"\n\" }
void acknowledge (string s) {print \"Acknowledge: \" s \"\n\" }
void infobox (string s) {print \"Info: \" s \"\n\" }
void info (string s) {print \"Info: \" s \"\n\" }
DB theDiag = null
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
{
#include <standard/export/office/word.dxl>
set(exportLayoutChoice, layoutTypeTable)
set(exportHeadingsToggle, false)
set(exportWarnUnregOLE, false)
set(exportAttributeToggle,true)
set(useStyleToggle, false)
set(styleMappingToggle, true)
set(advancedNormalTemplateToggle, false)
set(advancedTemplateName, (NLS_(\"Choose Correct Template File.dot\")))
inactive exportAttributeToggle
active advancedTemplateName
active advancedTemplateLabel
if (!null theDiag) destroy theDiag
}
}
}
lastError()
"
Trigger trg
bool TrigOK = true
string ErrMess = checkDXL(DXLCode)
if (!null ErrMess)
{
print ErrMess "\n***********\n" DXLCode "**********\n"
TrigOK = false
}
string NameTrig = "Export Status Trigger"
string Prompt = "Delete trigger '" NameTrig "' ??"
if (!TrigOK) Prompt = "Trigger code has errors.\n" Prompt
if (confirm(Prompt))
ErrMess = delete (NameTrig, module->attribute->"Export Status", post, save, 15)
if (TrigOK and confirm("Deploy trigger '" NameTrig "' ??"))
trg = trigger(NameTrig, module->attribute->"Export Status", post, save, 15, DXLCode)
|
Re: Customisation of Word Export options dyfuse - Tue Dec 02 19:22:36 EST 2014 Thanks for your quick reply Mathias! A DXL newbie here, so it's greatly appreciated! I've had a look around the forums and have added the hooks (hook show/block and call realize instead). However, in step 4 above you note to "call block / show (or trigger the dialog action directly)". I'm not sure how to do this....can you tell me how I can achieve this? And will this step reproduce a new Word Export dialog box with the correct options that I've set? My revised code now:
string DXLCode = "
Trigger trg = current; if (null trg) halt()
Module m = current; if (null m) halt ()
string exportstatus = m.\"Export Status\"
noError()
if(!null exportstatus and exportstatus == \"True\")
{
if(load view \"Export Matrix View\")
{
bool confirm (string s) { print \"Confirmed: \" s \"\n\"; return true }
void ack (string s) {print \"Acknowledge: \" s \"\n\" }
void acknowledge (string s) {print \"Acknowledge: \" s \"\n\" }
void infobox (string s) {print \"Info: \" s \"\n\" }
void info (string s) {print \"Info: \" s \"\n\" }
DB theDiag = null
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
{
#include <standard/export/office/word.dxl>
set(exportLayoutChoice, layoutTypeTable)
set(exportHeadingsToggle, false)
set(exportWarnUnregOLE, false)
set(exportAttributeToggle,true)
set(useStyleToggle, false)
set(styleMappingToggle, true)
set(advancedNormalTemplateToggle, false)
set(advancedTemplateName, (NLS_(\"Choose Correct Template File.dot\")))
inactive exportAttributeToggle
active advancedTemplateName
active advancedTemplateLabel
if (!null theDiag) destroy theDiag
}
}
}
lastError()
"
Trigger trg
bool TrigOK = true
string ErrMess = checkDXL(DXLCode)
if (!null ErrMess)
{
print ErrMess "\n***********\n" DXLCode "**********\n"
TrigOK = false
}
string NameTrig = "Export Status Trigger"
string Prompt = "Delete trigger '" NameTrig "' ??"
if (!TrigOK) Prompt = "Trigger code has errors.\n" Prompt
if (confirm(Prompt))
ErrMess = delete (NameTrig, module->attribute->"Export Status", post, save, 15)
if (TrigOK and confirm("Deploy trigger '" NameTrig "' ??"))
trg = trigger(NameTrig, module->attribute->"Export Status", post, save, 15, DXLCode)
Looks good so far ... Regarding your question to call the original show / block: Once you override block / show be redeclaring it, you cannot access it anymore. Because of that you can place a function before the hook, that will allow you to access the function with a different name:
void showOld(DB x) { show x } // will call old show -> before hook
void show (DB x) { realize x } // will override show
void blockOld(DB x) { block x } // will call old show -> before hook
void block (DB x) { realize x } // will override show
// ...
// will call block or show to bring the dialog to screen
// however with the hook in place it will only call 'realize'
#include <..word.dxl...>
// DXL execution continues here, so set the options:
set (...)
set (...)
showOld dialogBoxHandle
When you do not know the dialog box handle, you can save it from the hook:
DB gShownDialog = null
void showOld(DB x) { show x }
void show (DB x) { gShownDialog = x; realize x; }
#include ...
if (null gShownDialog) error "Show not called!"
show gShownDialog
Note that some dialog functionality only works when the dialog is already realized, some functionality only works when the dialog is not yet realized (like adding elements). If you want to add a GUI element for example, then you would NOT call realize, but just save the handle inside the hook. Then you add your elements. Then you call show/block ... Instead of calling the original show / block you can of course also directly trigger the GUI action that is assigned to some button. For that you just call the DBE handler function. Hope this helps, regards, Mathias |
Re: Customisation of Word Export options Mathias Mamsch - Wed Dec 03 04:15:45 EST 2014 Looks good so far ... Regarding your question to call the original show / block: Once you override block / show be redeclaring it, you cannot access it anymore. Because of that you can place a function before the hook, that will allow you to access the function with a different name:
void showOld(DB x) { show x } // will call old show -> before hook
void show (DB x) { realize x } // will override show
void blockOld(DB x) { block x } // will call old show -> before hook
void block (DB x) { realize x } // will override show
// ...
// will call block or show to bring the dialog to screen
// however with the hook in place it will only call 'realize'
#include <..word.dxl...>
// DXL execution continues here, so set the options:
set (...)
set (...)
showOld dialogBoxHandle
When you do not know the dialog box handle, you can save it from the hook:
DB gShownDialog = null
void showOld(DB x) { show x }
void show (DB x) { gShownDialog = x; realize x; }
#include ...
if (null gShownDialog) error "Show not called!"
show gShownDialog
Note that some dialog functionality only works when the dialog is already realized, some functionality only works when the dialog is not yet realized (like adding elements). If you want to add a GUI element for example, then you would NOT call realize, but just save the handle inside the hook. Then you add your elements. Then you call show/block ... Instead of calling the original show / block you can of course also directly trigger the GUI action that is assigned to some button. For that you just call the DBE handler function. Hope this helps, regards, Mathias Once again thanks Mathias! That helps a lot! I've amended the DXL (shown below) and the window pops up as expected with the correct options set and the everything in the Word Export dialog box is functional EXCEPT the "CLOSE" button at the bottom! Clicking the "Close" button does not do anything and as such I have an un-closable dialog box. *sad face* Any ideas why the close button does not function?
string DXLCode = "
Trigger trg = current; if (null trg) halt()
Module m = current; if (null m) halt ()
string exportstatus = m.\"Export Status\"
noError()
if(!null exportstatus and exportstatus == \"True\")
{
if(load view \"Export Matrix View\")
{
bool confirm (string s) { print \"Confirmed: \" s \"\n\"; return true }
void ack (string s) {print \"Acknowledge: \" s \"\n\" }
void acknowledge (string s) {print \"Acknowledge: \" s \"\n\" }
void infobox (string s) {print \"Info: \" s \"\n\" }
void info (string s) {print \"Info: \" s \"\n\" }
DB theDialog = null
void showOld (DB x) { show x }
void show (DB x) { theDialog = x; realize x }
void blockOld (DB x) { block x }
void block (DB x) { theDialog = x; realize x }
{
#include <standard/export/office/word.dxl>
set(exportLayoutChoice, layoutTypeTable)
set(exportHeadingsToggle, false)
set(exportWarnUnregOLE, false)
set(exportAttributeToggle,true)
set(useStyleToggle, false)
set(styleMappingToggle, true)
set(advancedNormalTemplateToggle, false)
set(advancedTemplateName, (NLS_(\"Choose Correct Template File.dot\")))
inactive exportAttributeToggle
active advancedTemplateName
active advancedTemplateLabel
if (null theDialog) error \"Show not called!\"
raise theDialog
showOld theDialog
}
}
}
lastError()
"
Trigger trg
bool TrigOK = true
string ErrMess = checkDXL(DXLCode)
if (!null ErrMess)
{
print ErrMess "\n***********\n" DXLCode "**********\n"
TrigOK = false
}
string NameTrig = "Export Status Trigger"
string Prompt = "Delete trigger '" NameTrig "' ??"
if (!TrigOK) Prompt = "Trigger code has errors.\n" Prompt
if (confirm(Prompt))
ErrMess = delete (NameTrig, module->attribute->"Export Status", post, save, 15)
if (TrigOK and confirm("Deploy trigger '" NameTrig "' ??"))
trg = trigger(NameTrig, module->attribute->"Export Status", post, save, 15, DXLCode)
|
Re: Customisation of Word Export options dyfuse - Wed Dec 03 19:30:18 EST 2014 Once again thanks Mathias! That helps a lot! I've amended the DXL (shown below) and the window pops up as expected with the correct options set and the everything in the Word Export dialog box is functional EXCEPT the "CLOSE" button at the bottom! Clicking the "Close" button does not do anything and as such I have an un-closable dialog box. *sad face* Any ideas why the close button does not function?
string DXLCode = "
Trigger trg = current; if (null trg) halt()
Module m = current; if (null m) halt ()
string exportstatus = m.\"Export Status\"
noError()
if(!null exportstatus and exportstatus == \"True\")
{
if(load view \"Export Matrix View\")
{
bool confirm (string s) { print \"Confirmed: \" s \"\n\"; return true }
void ack (string s) {print \"Acknowledge: \" s \"\n\" }
void acknowledge (string s) {print \"Acknowledge: \" s \"\n\" }
void infobox (string s) {print \"Info: \" s \"\n\" }
void info (string s) {print \"Info: \" s \"\n\" }
DB theDialog = null
void showOld (DB x) { show x }
void show (DB x) { theDialog = x; realize x }
void blockOld (DB x) { block x }
void block (DB x) { theDialog = x; realize x }
{
#include <standard/export/office/word.dxl>
set(exportLayoutChoice, layoutTypeTable)
set(exportHeadingsToggle, false)
set(exportWarnUnregOLE, false)
set(exportAttributeToggle,true)
set(useStyleToggle, false)
set(styleMappingToggle, true)
set(advancedNormalTemplateToggle, false)
set(advancedTemplateName, (NLS_(\"Choose Correct Template File.dot\")))
inactive exportAttributeToggle
active advancedTemplateName
active advancedTemplateLabel
if (null theDialog) error \"Show not called!\"
raise theDialog
showOld theDialog
}
}
}
lastError()
"
Trigger trg
bool TrigOK = true
string ErrMess = checkDXL(DXLCode)
if (!null ErrMess)
{
print ErrMess "\n***********\n" DXLCode "**********\n"
TrigOK = false
}
string NameTrig = "Export Status Trigger"
string Prompt = "Delete trigger '" NameTrig "' ??"
if (!TrigOK) Prompt = "Trigger code has errors.\n" Prompt
if (confirm(Prompt))
ErrMess = delete (NameTrig, module->attribute->"Export Status", post, save, 15)
if (TrigOK and confirm("Deploy trigger '" NameTrig "' ??"))
trg = trigger(NameTrig, module->attribute->"Export Status", post, save, 15, DXLCode)
Did you check, if the original word.dxl calls "block" or "show" ? My guess is, it calls block (could look but I am to lazy). If you block a dialog, you close it differently (release, destroy) ... On a shown dialog this will not work and probably crash something due to destroy. So I would look into word.dxl and check if it calls show or block. (You can also put a print statement to your hooks, to check). Then verify that you call the same function to bring the dialog box to the screen. Íf you want to change the display mode from "block" to "show" you should also hook "release" (call hide instead) and "destroy" (do nothing instead). Hope this helps, regards, Mathias |
Re: Customisation of Word Export options Mathias Mamsch - Thu Dec 04 05:35:16 EST 2014 Did you check, if the original word.dxl calls "block" or "show" ? My guess is, it calls block (could look but I am to lazy). If you block a dialog, you close it differently (release, destroy) ... On a shown dialog this will not work and probably crash something due to destroy. So I would look into word.dxl and check if it calls show or block. (You can also put a print statement to your hooks, to check). Then verify that you call the same function to bring the dialog box to the screen. Íf you want to change the display mode from "block" to "show" you should also hook "release" (call hide instead) and "destroy" (do nothing instead). Hope this helps, regards, Mathias The word.dxl calls block, so I did the same, replacing "showOld" with "blockOld" and it worked a treat! Thanks Mathias! |